<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>

<style>

#wrap-contactus{float:left;width:420px;margin-top:10px;margin-bottom:20px;margin-left:0px;}
	
.wrap-input{float:left;width:100%;clear:both;margin:3px 0px;}

.wrap-input .text-label{
	float:left;width:150px;display:block;min-height:15px;
}
.wrap-input .input-field{
	float:left;width:250px;display:block;
	padding-left:5px;
}

.input-field input{width:200px;}

.input-field input.button{width:auto!important;padding:0px 10px;}

textarea.message{width:200px;height:85px;}

#errorbox{
	color:red;
}

#successbox{
}

</style> 

<?php 
	function contactus(){
		$form = site_url('home/contactus');
		$captcha = newCaptcha();
		$loader=  loader_image('id="loader_image" class="hidden"'); 
		
		$html = "";
		$html .= "<div id=\"wrap-contactus\">";
		$html .= "<form action=\"{$form}\" id=\"contactus\" name=\"contactus\" method=\"post\" >";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\">
					<label>".language_translate('contact_sys_name')."</label>
					<div class=\"help-text\" title='".language_translate('contact_sys_name_hint')."'></div>
				</div>";
		$html .= "<div class=\"input-field\"><input type='text' name='name' id='name' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\">
					<label>".language_translate('contact_sys_email')."</label>
					<div class=\"help-text\" title='".language_translate('contact_sys_email_hint')."'></div>	
				</div>";
		$html .= "<div class=\"input-field\"><input type='text' name='email' id='email' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\">
					<label>".language_translate('contact_sys_mobile')."</label>
					<div class=\"help-text\" title='".language_translate('contact_sys_mobile_hint')."'></div>	
				</div>";
		$html .= "<div class=\"input-field\"><input type='text' name='mobile' id='mobile' maxlength='45' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\">
					<label>".language_translate('contact_sys_subject')."</label>
					<div class=\"help-text\" title='".language_translate('contact_sys_subject_hint')."'></div>	
				</div>";
		$html .= "<div class=\"input-field\"><input type='text' name='subject' id='subject' maxlength='145' /></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\">
					<label>".language_translate('contact_sys_message')."</label>
					<div class=\"help-text\" title='".language_translate('contact_sys_message_hint')."'></div>	
				</div>";
		$html .= "<div class=\"input-field\"><textarea class='message' name='message' id='message' maxlength='550' ></textarea></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\">
					<label>".language_translate('contact_sys_captcha')."</label>
					<div class=\"help-text\" title='".language_translate('contact_sys_captcha_hint')."'></div>	
				</div>";
		$html .= "<div class=\"input-field\">
					<div id=\"captcha-section\">{$captcha}</div> 
					<div id=\"captcha-reload\"></div>
					<div class=\"clrboth\"></div>  
					<div style='float:left;clear:left;margin-top:5px;'>
						<input type='text' name='captcha' id='captcha' maxlength='15' />
					</div>
				</div>";
		$html .= "</div>";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field\">
					<input type='submit' class='save-button' name='send' id='send' value='".language_translate('contact_sys_send')."' />
					{$loader}
				</div>";
		$html .= "</div>"; 
		
		$html .= "</form>";
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field hidden\" id='errorbox'></div>";
		$html .= "</div>"; 
		
		$html .= "<div class=\"wrap-input\">";
		$html .= "<div class=\"text-label\"><label></label></div>";
		$html .= "<div class=\"input-field hidden\" id='successbox'></div>";
		$html .= "</div>"; 
		
		$html .= "</div>";
		
		$html .= "<script type='text/javascript'>
				$(document).ready(function(){
					var option = { 
							beforeSubmit:  validateBeforeSubmit,  
							success: processAfterSubmit
						};	
					$('#contactus').ajaxForm(option);
					$('.help-text[title]').qtip({ style: { name: 'dark', tip: true } });
				});
				function validateBeforeSubmit(formData, jqForm, options){
					$('#successbox,#errorbox').hide();
					$('#loader_image').toggle();
					return true;
				}
				function processAfterSubmit(responseText, statusText, xhr, form){
					var obj = jQuery.parseJSON( responseText );
					 
					$('#loader_image').toggle();
					if(obj.result == 'ok'){
						$('#successbox').html(obj.msg).show();
						queryurl(BASE_URI+'home/contact_notify');
					}else{
						$('#errorbox').html(obj.msg).show();
					}
				}
			</script>
		";
		
		return $html;
	}

?>

<div class="home-escort-list">
	<div class="clear"></div>
	<table>
		<tr>
			<td width="50%">
				<?php echo contactus();?>
			</td>
			<td width="50%" style="vertical-align:top;padding-top:10px;padding-left:15px;">
				<?php $this->load->view('banner/contact_page_banner',array('pos'=>'contact_page') ); ?>
			</td>
		</tr>
	</table>	
	<div class="clear"></div>
</div>

<div class="clear"></div>
<div class="bottom-content-wrapper">
	<?php $this->load->view('news/list_news',array('pos'=>'register') ); ?>
</div>
<div class="clear"></div>
<div class="bottom-content-wrapper">
	<?php $this->load->view('banner/bottom_banner',array('pos'=>'register_page') ); ?>
</div>  
		